home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / msdos / viewers / pvquan16 / vga / vga_retr.c < prev    next >
C/C++ Source or Header  |  1992-11-30  |  1KB  |  36 lines

  1. /************************************************************************
  2.  *                                                                      *
  3.  *                  Copyright (c) 1991, Frank van der Hulst             *
  4.  *                          All Rights Reserved                         *
  5.  *                                                                      *
  6.  * Authors:                                                             *
  7.  *          FvdH - Frank van der Hulst (Wellington, NZ)                     *
  8.  *                                                                      *
  9.  * Versions:                                                            *
  10.  *    V1.1 910626 FvdH - QUANT released for DBW_RENDER                    *
  11.  *    V1.2 911021 FvdH - QUANT released for PoV Ray                      *
  12.  *    V1.3 911030 FvdH - Added 320x200x256x4 pages support                    *
  13.  *                                                                      *
  14.  ************************************************************************/
  15. /*
  16. VGA Vertical retrace detection module.
  17. */
  18.  
  19. #include <dos.h>
  20.  
  21. #include "vga.h"
  22.  
  23. #define DISPIO             0x3DA
  24. #define VRT_bit            8
  25.  
  26. void WaitForVerticalRetrace(void)
  27. {
  28. static char chopper = 1;
  29.  
  30.     while (inportb(DISPIO) & VRT_bit)             /* wait */ ;
  31.     while ((inportb(DISPIO) & VRT_bit) == 0)    /* wait */ ;
  32.     if ((chopper++ & 1)== 0)        outportb(0x3fc, 1);
  33.     else                                    outportb(0x3fc, 3);
  34. }
  35.  
  36.